package com.lwm.service.impl;

import cn.hutool.core.util.IdUtil;
import com.lwm.domain.SalesContractMaterials;
import com.lwm.mapper.SalesContractMaterialsMapper;
import com.lwm.service.SalesContractMaterialsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SalesContractMaterialsServiceImpl implements SalesContractMaterialsService {
    @Resource
    private SalesContractMaterialsMapper salesContractMaterialsMapper;

    @Override
    public List<SalesContractMaterials> getList(List<Long> ids) {
        return salesContractMaterialsMapper.getList(ids);
    }

    @Override
    public Integer removeBySalesContractId(Long id) {
        return salesContractMaterialsMapper.removeBySalesContractId(id);
    }

    @Override
    public Integer batchInsert(List<SalesContractMaterials> salesContractMaterials) {
        salesContractMaterials.forEach(item -> item.setId(IdUtil.getSnowflakeNextId()));
        return salesContractMaterialsMapper.batchInsert(salesContractMaterials);
    }
}
